<?php 
// --- block list tab --- {{
/**
 * @param string $type
 * @param Zend_View $that
 * @return unknown_type
 */
function blockListTab($type, $that) { 
?>
<script type="text/javascript">
$(document).ready(function(){
	$("#pager_block_<?php echo $type;?>").mainPager({
		name: 'block_<?php echo $type;?>',
		pager: "#pager_block_<?php echo $type;?>",
		url: '/page/admin/ajax.pager.block/type/<?php echo $type;?>/page_id/<?php echo $that->pageId?><?php echo Main_Const::getSeriveUrlStr(); ?>',
		urlEdit: '/page/admin/block.edit/page_id/<?php echo $that->pageId;?><?php echo Main_Const::getSeriveUrlStr(); ?>',
		simpleSearchClass: 'simple-search-block-<?php echo $type;?>',
		dialogDeleteId: 'dialog-delete-block-<?php echo $type;?>',
		dialogErrorId: 'dialog-error-block-<?php echo $type;?>',
		loadingMessageClass: "loading-message-block-<?php echo $type;?>",
		rowList: [2,4,6,8],
		rowNum: 2,
		colNames: {
			id: 'ID',
			name: 'Имя',
			description: 'Описание',
			f_active: 'Статус'
		},
		colModel: {
			id: {index: ['id'], width: '12%'},
			name: {index: ['name'], width: '26%'},
			description: {index: ['description'], width: '26%'},
			f_active: {index: ['f_active'], width: '26%', handler: 'pagerIsActiveHandler'}
		},
		emptyList: 'Список пуст',
		actionsWidth: '8%'
	});
});
</script>

<div class="button">
<button type="submit" onclick="window.location='/page/admin/block.add/type/<?php echo $type;?>/page_id/<?php echo $that->pageId?><?php echo Main_Const::getSeriveUrlStr(); ?>'" class="controll-button" name="Submit" >Добавить</button>
</div>
<div style="text-align: right; margin-right: 12px;">
	<input type="text" class="simple-search-block-<?php echo $type;?>" />
</div>

<div id="pager_block_<?php echo $type;?>"></div>	
<?php } // --- block list tab --- }}?>	


<script type="text/javascript">
	$(function() {
		$("#tabs").tabs({selected : <?php echo $this->tabId; ?>});
	});
</script>

<?php
$breadcrumbs = ''; 
if (!empty($this->ascendantBranch)) {
	foreach ($this->ascendantBranch as $ascendantItemName) {
		$breadcrumbs .= $ascendantItemName;
		$breadcrumbs .= '/';
	}
}
?>

<p class="breadcrumbs">
<a href="/page/admin/page.list/<?php echo Main_Const::getSeriveUrlStr(); ?>">Страницы</a> &gt; 
<a href="/page/admin/page.edit/id/<?php echo $this->pageItem['id']; ?><?php echo Main_Const::getSeriveUrlStr(); ?>">
	<?php echo $breadcrumbs; echo !empty($this->pageItem['name']) ? $this->pageItem['name'] : 'Главная страница'; ?>
</a> &gt; 
Блоки
</p>

<div class="pager-tabs">
<div id="tabs">
	<ul>	
		<li><a href="#tabs-0">Общие (<?php echo (!empty($this->blockStatistics)) ? $this->blockStatistics[0] : 0; ?>)</a></li>
		<?php 
		foreach ($this->langs as $langId => $langItem) {
			?><li><a href="#tabs-<?php echo $langId; ?>"><?php echo $langItem['abbr']; ?> (<?php echo (!empty($this->blockStatistics)) ? $this->blockStatistics[$langId] : 0?>)</a></li><?php 
		}
		?>
	</ul>
	
	<div id="tabs-0">
		<?php blockListTab(0, $this); ?>		
	</div>
	<?php foreach ($this->langs as $langId => $langItem) {?>
	<div id="tabs-<?php echo $langId;?>">
		<?php blockListTab($langId, $this); ?>
	</div>
	<?php } ?>
	
</div>
</div><!-- End demo -->
